﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.ComponentModel;
using System.Reflection;

#endregion

namespace Rio.Applications.Web.Services
{   
    /// <summary>
    /// Class to handle enum for Login
    /// </summary>
    public class LoginDomainServiceEnums
    {
        /// <summary>
        /// Supported method of Authentication
        /// </summary>
        public enum AuthenticationMethod
        {
            /// <summary>
            /// Authentication by SSO
            /// </summary>
            SSO = 0,
            /// <summary>
            /// Authentication by user/password
            /// </summary>
            UserPassword = 1,
            /// <summary>
            /// Authentication by Ldap
            /// </summary>
            Ldap = 2,
        }
    }

    public class ErrorCodesEnums
    {
        /// <summary>
        /// Defines error codes of ReturnObject class. 
        /// </summary>
        public enum ReturnObjectErrorCodesEnum
        {
            /// <summary>
            /// Success, all ok
            /// </summary>
            [DescriptionAttribute("Process succeed")]
            Success = 0,

            /*
             * General Errors
             */

            /// <summary>
            /// Server not found
            /// </summary>
            [DescriptionAttribute("Server not found")]
            ServerNotFound = 9001,
            /// <summary>
            /// An unknow error
            /// </summary>
            [DescriptionAttribute("An unknow error has occured")]
            UnknowError = 9002,
            /// <summary>
            /// Internal Error
            /// <remarks>
            /// Generaly when a code try to store a unknown error code
            /// </remarks>
            /// </summary>
            [DescriptionAttribute("Internal Error")]
            InternalError = 9003,
            /// <summary>
            /// The file is corrupted.
            /// </summary>
            [DescriptionAttribute("The current file is corrupted")]
            CorruptedFile = 9004,
            /// <summary>
            /// No data
            /// </summary>
            [DescriptionAttribute("No data found")]
            NoData = 9005,
            /// <summary>
            /// File not found
            /// </summary>
            [DescriptionAttribute("File not found")]
            FileNotFound = 9006,

            /*
             * Import Mode
             */

            /// <summary>
            /// An error has occured while deleting a file in the import mode.
            /// </summary>
            [DescriptionAttribute("An error has occured while deleting a file in the import mode")]
            DeletingFileDuringImportError = 9101,
            /// <summary>
            /// An error has occured while rotating a file in the import mode.
            /// </summary>
            [DescriptionAttribute("An error has occured while rotating a file in the import mode")]
            RotationFileDuringImportError = 9102,
            /// <summary>
            /// An error has occured while saving a file in the import mode.
            /// </summary>
            [DescriptionAttribute("An error has occured while saving a file in the import mode")]
            SaveFileDuringImportError = 9103,
            /// <summary>
            /// An error has occured while merging a file in the import mode.
            /// </summary>
            [DescriptionAttribute("An error has occured while merging a file in the import mode")]
            MergeFileDuringImportError = 9104,
        }
    }
    
    public class AlertEnums
    {
        /// <summary>
        /// Supported method of Authentication
        /// </summary>
        public enum StatusEnum
        {
            /// <summary>
            /// New
            /// </summary>
            New = 1,
            /// <summary>
            /// Waiting to be sent
            /// </summary>
            Waiting = 2,
            /// <summary>
            /// Sent
            /// </summary>
            Sent = 3,
            /// <summary>
            /// Deleted
            /// </summary>
            Deleted = 4,
            /// <summary>
            /// Error
            /// </summary>
            Error = 5,


        }
    }

    /// <summary>
    /// Class to handle enum for Login
    /// </summary>
    public class FlowEnums
    {
        /// <summary>
        /// Supported method of Authentication
        /// </summary>
        public enum ChronoTypeEnum
        {
            /// <summary>
            /// None
            /// </summary>
            None = 0,
            /// <summary>
            /// InBox flow
            /// </summary>
            InBox = 1,
            /// <summary>
            /// OutBox flow
            /// </summary>
            OutBox = 2,
        }

        /// <summary>
        /// Supported status of chrono
        /// </summary>
        public enum ChronoStatusEnum
        {
            /// <summary>
            /// None
            /// </summary>
            None = 0,
            /// <summary>
            /// Booked chrono
            /// </summary>
            Booked = 1,
            /// <summary>
            /// Free chrono
            /// </summary>
            Free = 2,
            /// <summary>
            /// Immovable chrono
            /// </summary>
            Immovable = 3,
        }
    }

    public class SearchEnums
    {
        public enum FullSearchOperator
        {
            /// <summary>
            /// And operand
            /// </summary>
            [DescriptionAttribute("AND")]
            AND = 0,
            /// <summary>
            /// Or operand
            /// </summary>
            [DescriptionAttribute("OR")]
            OR = 1
        }
    }
    /// <summary>
    /// Class to handle enum for Login
    /// </summary>
    public class IndexDomainServiceEnums
    {
        /// <summary>
        /// Type of Index (WARNING : This is the reference)
        /// <remarks>
        /// I can't move this enum in NetbayCore or in our Framework.
        /// Any modification must deploy in extension for Index in IndexRepository!
        /// </remarks>
        /// </summary>
        public enum IndexType
        {
            /// <summary>
            /// None
            /// </summary>
            None = 0,
            /// <summary>
            /// Chaine
            /// </summary>
            String = 1,
            /// <summary>
            /// Entier
            /// </summary>
            Integer = 2,
            /// <summary>
            /// Double
            /// </summary>
            Double = 3,
            /// <summary>
            /// Date
            /// </summary>
            Date = 4,
            /// <summary>
            /// Urilisateurs
            /// </summary>
            Users = 5,
            /// <summary>
            /// OuiNon
            /// </summary>
            Boolean = 6,
            /// <summary>
            /// Chaine_contenant_uniquement_des_chiffres
            /// </summary>
            IntegerString = 7,
            /// <summary>
            /// Liste_de_valeurs
            /// </summary>
            ListOfValues = 8,
            /// <summary>
            /// TypeDocument
            /// </summary>
            DocumentType = 9,
            /// <summary>
            /// Groups
            /// </summary>
            Groups = 10,
            /// <summary>
            /// ListeOfRecipient
            /// </summary>
            ListeOfRecipient = 11,
            /// <summary>
            /// Object
            /// </summary>
            Object = 12,
            /// <summary>
            /// Type of flow
            /// </summary>
            TypeFlow = 13,
            /// <summary>
            /// Type of flow
            /// </summary>
            TypeChrono = 14,
            /// <summary>
            /// Type of liste emetteur
            /// </summary>
            ListOfSenders = 15,

        }
    }

    /// <summary>
    /// Class to handle enum for Active Directory
    /// </summary>
    public class ActiveDirectoryEnums
    {
        public enum AdObjectType
        {
            /// <summary>
            /// All type of objects
            /// </summary>
            All = 0,
            /// <summary>
            /// Ad User type object
            /// </summary>
            User = 1,
            /// <summary>
            /// Ad Group type object
            /// </summary>
            Group = 2
        }
    }

    public static class Constant
    {

        #region Enum
        public enum ImageFileFormat
        {
            [DescriptionAttribute(".jpg")]
            JPG,
            [DescriptionAttribute(".jpeg")]
            JPEG,
            [DescriptionAttribute(".tiff")]
            TIFF,
            [DescriptionAttribute(".tif")]
            TIF,
            [DescriptionAttribute(".png")]
            PNG,
            [DescriptionAttribute(".bmp")]
            BMP,
            [DescriptionAttribute(".gif")]
            GIF

        }

        public enum RioScanImageFileFormat
        {
            [DescriptionAttribute(".jpg")]
            JPG,
            [DescriptionAttribute(".jpeg")]
            JPEG,
            [DescriptionAttribute(".tiff")]
            TIFF,
            [DescriptionAttribute(".tif")]
            TIF
        }

        public enum VideoFileFormat
        {
            [DescriptionAttribute(".wmv")]
            WMV,
            [DescriptionAttribute(".avi")]
            AVI,
            [DescriptionAttribute(".mpeg")]
            MPEG
        }


        public enum DocumentFileFormat
        {
            [DescriptionAttribute(".pdf")]
            PDF,
            [DescriptionAttribute(".xls")]
            XLS,
            [DescriptionAttribute(".xlsx")]
            XLSX,
            [DescriptionAttribute(".doc")]
            DOC,
            [DescriptionAttribute(".docx")]
            DOCX,
            [DescriptionAttribute(".ppt")]
            PPT,
            [DescriptionAttribute(".pptx")]
            PPTX,
            [DescriptionAttribute(".rtf")]
            RTF,
            [DescriptionAttribute(".txt")]
            TXT,
        }

        #endregion


        public enum UserActions
        {
            /// <summary>
            /// None
            /// </summary> 
            [DescriptionAttribute("Not Define")]
            None = 0,
            /// <summary>
            /// CONNEXION
            /// </summary> 
            [DescriptionAttribute("CONNEXION")]
            CONNEXION ,
            /// <summary>
            /// DECONNEXION 
            /// </summary>
            [DescriptionAttribute("DECONNEXION")]
            DECONNEXION, /// <summary>
            /// NUMERISATION
            /// </summary>
            [DescriptionAttribute("NUMERISATION")]
            NUMERISATION, /// <summary>
            /// IMPORTATION
            /// </summary>
            [DescriptionAttribute("IMPORTATION")]
            IMPORTATION , /// <summary>
            /// VENTILATION (par document)
            /// </summary>
            [DescriptionAttribute("VENTILATION")]
            VENTILATION , /// <summary>
            /// CREATION_DOSSIER (en validant un nouveau dossier est créé)
            /// </summary>
            [DescriptionAttribute("CREATION_DOSSIER")]
            CREATION_DOSSIER , /// <summary>
            /// AJOUT_DOCUMENTS_DOSSIER (liste des documents du dossier)
            /// </summary>
            [DescriptionAttribute("AJOUT_DOCUMENTS_DOSSIER")]
            AJOUT_DOCUMENTS_DOSSIER , /// <summary>
            /// SUPRESSION_DOSSIER
            /// </summary>
            [DescriptionAttribute("SUPRESSION_DOSSIER")]
            SUPRESSION_DOSSIER , /// <summary>
            /// SUPPRESSION_IMAGE
            /// </summary>
            [DescriptionAttribute("SUPPRESSION_IMAGE")]
            SUPPRESSION_IMAGE , /// <summary>
            /// REORGANISATION_DOSSIER  (modification du rang des docs dans un dossier)
            /// </summary>
            [DescriptionAttribute("REORGANISATION_DOSSIER")]
            REORGANISATION_DOSSIER , /// <summary>
            /// MODIFICATION_INDEX (modification d’un index de dossier)
            /// </summary>
            [DescriptionAttribute("MODIFICATION_INDEX")]
            MODIFICATION_INDEX , /// <summary>
            /// MODIFICATION_AUTORISATIONS  (autorisations dossier)
            /// </summary>
            [DescriptionAttribute("MODIFICATION_AUTORISATIONS")]
            MODIFICATION_AUTORISATIONS ,
            /// AJOUT_NOTE   (ajout note au dossier)
            /// </summary>
            [DescriptionAttribute("AJOUT_NOTE")]
            AJOUT_NOTE ,
            /// CLASSEMENT_DOSSIER  (placement d’un doc dans un item)
            /// </summary>
            [DescriptionAttribute("CLASSEMENT_DOSSIER")]
            CLASSEMENT_DOSSIER ,
            /// CONSULTATION   (par document)
            /// </summary>
            [DescriptionAttribute("CONSULTATION")]
            CONSULTATION ,
            /// IMPRESSION   (par document)
            /// </summary>
            [DescriptionAttribute("IMPRESSION")]
            IMPRESSION ,
            /// TELECHARGEMENT   (par document)
            /// </summary>
            [DescriptionAttribute("TELECHARGEMENT")]
            TELECHARGEMENT ,
            /// EXPORT_EXCEL   (par dossier)
            /// </summary>
            [DescriptionAttribute("EXPORT_EXCEL")]
            EXPORT_EXCEL ,
            /// ENVOI_PAR_MAIL    (par document)
            /// </summary>
            [DescriptionAttribute("ENVOI_PAR_MAIL ")]
            ENVOI_PAR_MAIL,
            /// AJOUT_VERSION_MAJEUR    (par document)
            /// </summary>
            [DescriptionAttribute("AJOUT_VERSION")]
            AJOUT_VERSION,
            /// OUVERTURE_DOSSIER    (par dossier)
            /// </summary>
            [DescriptionAttribute("OUVERTURE_DOSSIER")]
            OUVERTURE_DOSSIER,
            /// RECHERCHE    (par dossier)
            /// </summary>
            [DescriptionAttribute("RECHERCHE")]
            RECHERCHE,
            /// <summary>
            /// CONSULTATION DOSSIER
            /// </summary>
            [DescriptionAttribute("CONSULTATION_DOSSIER")]
            CONSULTATION_DOSSIER,
            /// <summary>
            /// COUPER
            /// </summary>
            [DescriptionAttribute("DOCUMENT_COUPER")]
            DOCUMENT_COUPER,
            /// <summary>
            /// COPIER
            /// </summary>
            [DescriptionAttribute("DOCUMENT_COPIER")]
            DOCUMENT_COPIER,
            /// <summary>
            /// COLLER
            /// </summary>
            [DescriptionAttribute("DOCUMENT_COLLER")]
            DOCUMENT_COLLER,
            [DescriptionAttribute("RESTAURATION_IMAGE")]
            RESTAURATION_IMAGE,
        }

        /// <summary>
        /// Extension(Enum) : Retreive the "DescriptionAttribute()" from an enum's item
        /// </summary>
        /// <param name="eInstance">instance of enum's item</param>
        /// <returns>the "DescriptionAttribute()"</returns>
        public static string szGetDescription(this Enum eInstance)
        {
            string sDescription = String.Empty;
            DescriptionAttribute da;

            FieldInfo fi = eInstance.GetType().GetField(eInstance.ToString());
            da = (DescriptionAttribute)Attribute.GetCustomAttribute(fi, typeof(DescriptionAttribute));
            if (da != null)
                sDescription = da.Description;
            else
                sDescription = eInstance.ToString();

            return sDescription;
        }

    } 
}